/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.jfbmonitor.view.database;

import java.awt.FontMetrics;
import javax.swing.table.DefaultTableColumnModel;
import javax.swing.table.TableColumn;
import org.jfbmonitor.language.Language;

/**
 *
 * @author Douglas
 */
public class DataBaseColumnModel extends DefaultTableColumnModel{
    private static final long serialVersionUID = 1L;

    public DataBaseColumnModel(FontMetrics fm){
		int number = fm.stringWidth("0");
		int character = fm.stringWidth("M");

		addColumn(createColumn(0, 20 * character, fm, Language.getInstance().getProperties("TABLE.COLUMN")));
        addColumn(createColumn(1, 40 * character, fm, Language.getInstance().getProperties("TABLE.VALUE")));
        
	}

    private TableColumn createColumn(int columnIndex, int width,FontMetrics fm, String title) {
		TableColumn col = new TableColumn(columnIndex);
		col.setCellRenderer(new DataBaseCellRenderer());
		col.setHeaderRenderer(null);
		col.setHeaderValue(title);
		col.setResizable(true);
		col.setMinWidth(0);
		col.setMaxWidth(width);
		return col;
	}
}
